package net.lahuobao.mall.service.impl.admin;

import net.lahuobao.mall.entity.admin.MallEcardRebateOrderEntity;
import net.lahuobao.mall.entity.admin.MallOrderEntity;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import net.lahuobao.mall.service.admin.MallEcardRebateOrderServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;

import java.util.List;

@Service("mallEcardRebateOrderService")
@Transactional
public class MallEcardRebateOrderServiceImpl extends CommonServiceImpl implements MallEcardRebateOrderServiceI {

    /**
     * 根据订单ids查询
     * @param orderIds
     * @return
     */
    @Override
    public List<MallEcardRebateOrderEntity> selectByorderIds(Integer[] orderIds) {
        CriteriaQuery cq = new CriteriaQuery(MallEcardRebateOrderEntity.class);
        cq.in("orderid", orderIds);
        cq.add();
        return super.getListByCriteriaQuery(cq, false);
    }


    /**
     * 根据ecard返点id删除中间表数据
     * @param ecardRebateId
     */
    @Override
    public void deleteByEcardRebateId(Integer ecardRebateId) {
        String sql = " delete  from lahuobao.mall_ecard_rebate_order where ecardrebateid = ? ";
        super.executeSql(sql, ecardRebateId);
    }


    /**
     *  根据ecard返点id获取中间表数据
     * @param ecardRebateId
     * @return
     */
    @Override
    public List<MallEcardRebateOrderEntity> selectByEcardRebateId(Integer ecardRebateId) {
        return super.findByProperty(MallEcardRebateOrderEntity.class, "ecardrebateid", ecardRebateId);
    }
}